var o = require("../../../@babel/runtime/helpers/defineProperty"), e = (require("../../../3D336854875DE5CF5B550053BF4D6824.js"), 
require("../../../FFE95507875DE5CF998F3D00DB5D6824.js"), require("../../../26C7E8E6875DE5CF40A180E17E6D6824.js"), 
null);

Page({
    data: o({
        type: "",
        bgUrl: "/images/face-bg.png",
        title: "一键生成动漫照",
        subtitle: "AI绘画，独一无二",
        statement: "<div>此功能成本较高，希望大家观看广告 <br/>支持一下开发者 🙏</div>"
    }, "statement", ""),
    onLoad: function(o) {
        this.loadContent("anime");
    },
    loadRewardAd: function() {
        var o = this;
        wx.createRewardedVideoAd && ((e = wx.createRewardedVideoAd({
            adUnitId: "adunit-8ed8fc094c31139a"
        })).onLoad(function() {
            console.log("激励视频 广告加载成功");
        }), e.onError(function(o) {
            console.log("激励广告加载失败", o);
        }), e.onClose(function(e) {
            console.log("激励广告关闭", e), e && e.isEnded && o.selectImage();
        }));
    },
    loadContent: function(o) {
        getApp().globalData.currentType = o;
    },
    chooseImage: function() {
        wx.showToast({
            title: "整改中..."
        });
    },
    showAdConfirm: function() {
        var o = this;
        wx.showModal({
            title: "提示",
            content: "观看完整视频广告，才能解锁哦！",
            cancelText: "忍痛放弃",
            confirmText: "立即解锁",
            confirmColor: "#576B95",
            success: function(e) {
                e.confirm ? (console.log("用户点击确定"), o.showRewardAd()) : e.cancel && console.log("用户点击取消");
            }
        });
    },
    showRewardAd: function() {
        e.show().then(function() {
            console.log("激励广告show");
        }).catch(function() {
            e.load().then(function() {
                return e.show();
            }).catch(function(o) {
                console.log("激励视频 广告显示失败");
            });
        });
    },
    selectImage: function() {
        var o = this;
        wx.chooseImage({
            count: 1,
            sizeType: [ "compressed" ],
            sourceType: [ "camera", "album" ],
            success: function(e) {
                console.log("choose image success:"), console.log(e);
                var n = e.tempFilePaths[0];
                o.saveAndJump(n);
            },
            fail: function(o) {
                console.log("取消了选择照片");
            }
        });
    },
    saveAndJump: function(o) {
        wx.navigateTo({
            url: "/pages/anime/detail/detail?filePath=" + o
        });
    },
    onReady: function() {
        console.log("facade.onready");
    },
    onShow: function() {
        console.log("facade.onshow");
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function(o) {
        return console.log("anime.detail.detail:onshareappmessage"), console.log(o), "button" === o.from ? console.log("按钮内分享") : "menu" === o.from && console.log("右上角菜单分享"), 
        {
            title: "一键生成个性卡通照，快来试试吧",
            imageUrl: "/images/baidu-anime.jpg",
            path: "/pages/anime/index/index",
            success: function(o) {
                console.log("转发成功");
            },
            fail: function() {
                console.log("转发失败");
            }
        };
    }
});